<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-for遍历对象</title>
</head>

<body>

  <div id="app">
    <!-- 1. 直接遍历，获取的item为属性值 -->
    <ul>
      <li v-for="item in info">{{ item }}</li>
    </ul>
    <hr>

    <!-- 2. (item, key) 需要获取属性名和属性值写法 -->
    <ul>
      <li v-for="(item, key) in info">{{ key }} - {{ item }}</li>
    </ul>
    <hr>

    <!-- 3. (item, key, index) 需要获取属性名和属性值+索引写法 -->
    <ul>
      <li v-for="(item, key, index) in info">{{ index }} - {{ key }} - {{ item }}</li>
    </ul>

  </div>

  <script src="../../js/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        info: {
          name: "Mr.chen",
          age: 18,
          height: 1.88,
        }
      }
    })
  </script>
</body>

</html>